# controls the rendering of real time graphs
class GraphsController < ApplicationController
  


  # GET /graphs/?project=[projectname]&bug_list=bug_list_0&team=[manager_username]
  # manager_username is optional. if left out, the project projections are displayed
  ## This action is called from the generator and displays a graph of the history
  ## projections and current count.
  ##
  ## because the generator (which doesn't know about our id fields) is asking for the page, 
  ## it has to use names like the short project and short bug list name
  def show
      @project = Project.find_by_short_name(params[:project])
      @bug_list = BugList.find(:first, :conditions => { "name" => params[:bug_list], :project_id => @project.id } )  

      if !params[:team].nil?
          manager = Person.find_by_username(params[:team])
          if !manager.nil?
            @team = Team.find(:first, :conditions => { :person_id => manager.id, :project_id => @project.id } )
          end
          ## this isn't finished yet.
      end
      if !params[:owner].nil?
        @owner = Person.find_by_username(params[:owner])
      end

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @bug_list_downloads }
    end
  end
  
  
  
end